// Copyright (c) 2024 CHANGLEI. All rights reserved.

import 'package:charts_grasp/src/core/theme.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

class CgChartTheme extends InheritedTheme {
  const CgChartTheme({super.key, required this.data, required this.child}) : super(child: child);

  final CgChartThemeData data;

  @override
  // ignore: overridden_fields
  final Widget child;

  static CgChartThemeData of(BuildContext context) {
    final CgChartTheme? chartTheme = context.dependOnInheritedWidgetOfExactType<CgChartTheme>();
    return chartTheme?.data ?? CgTheme.of(context).chartThemeData;
  }

  @override
  bool updateShouldNotify(CgChartTheme oldWidget) => data != oldWidget.data;

  @override
  Widget wrap(BuildContext context, Widget child) {
    final CgChartTheme? ancestorTheme = context.findAncestorWidgetOfExactType<CgChartTheme>();
    return identical(this, ancestorTheme) ? child : CgChartTheme(data: data, child: child);
  }
}

@immutable
class CgChartThemeData with Diagnosticable {
  factory CgChartThemeData({
    Brightness? brightness,
    Color? backgroundColor,
    Color? axisLabelColor,
    Color? axisTitleColor,
    Color? axisLineColor,
    Color? majorGridLineColor,
    Color? minorGridLineColor,
    Color? majorTickLineColor,
    Color? minorTickLineColor,
    Color? titleTextColor,
    Color? titleBackgroundColor,
    Color? legendTextColor,
    Color? legendTitleColor,
    Color? legendBackgroundColor,
    Color? plotAreaBackgroundColor,
    Color? plotAreaBorderColor,
    Color? crosshairLineColor,
    Color? crosshairBackgroundColor,
    Color? crosshairLabelColor,
    Color? tooltipColor,
    Color? tooltipLabelColor,
    Color? tooltipSeparatorColor,
    Color? selectionRectColor,
    Color? selectionRectBorderColor,
    Color? selectionTooltipConnectorLineColor,
    Color? waterfallConnectorLineColor,
    TextStyle? titleTextStyle,
    TextStyle? axisTitleTextStyle,
    TextStyle? axisLabelTextStyle,
    TextStyle? axisMultiLevelLabelTextStyle,
    TextStyle? plotBandLabelTextStyle,
    TextStyle? legendTitleTextStyle,
    TextStyle? legendTextStyle,
    TextStyle? dataLabelTextStyle,
    TextStyle? tooltipTextStyle,
    TextStyle? trackballTextStyle,
    TextStyle? crosshairTextStyle,
    TextStyle? selectionZoomingTooltipTextStyle,
  }) {
    brightness = brightness ?? Brightness.light;
    final bool isLight = brightness == Brightness.light;
    backgroundColor ??= Colors.transparent;
    axisLabelColor ??= isLight ? const Color.fromRGBO(104, 104, 104, 1) : const Color.fromRGBO(242, 242, 242, 1);
    axisTitleColor ??= isLight ? const Color.fromRGBO(66, 66, 66, 1) : const Color.fromRGBO(255, 255, 255, 1);
    axisLineColor ??= isLight ? const Color.fromRGBO(181, 181, 181, 1) : const Color.fromRGBO(101, 101, 101, 1);
    majorGridLineColor ??= isLight ? const Color.fromRGBO(219, 219, 219, 1) : const Color.fromRGBO(70, 74, 86, 1);
    minorGridLineColor ??= isLight ? const Color.fromRGBO(234, 234, 234, 1) : const Color.fromRGBO(70, 74, 86, 1);
    majorTickLineColor ??= isLight ? const Color.fromRGBO(181, 181, 181, 1) : const Color.fromRGBO(191, 191, 191, 1);
    minorTickLineColor ??= isLight ? const Color.fromRGBO(214, 214, 214, 1) : const Color.fromRGBO(150, 150, 150, 1);
    titleTextColor ??= isLight ? const Color.fromRGBO(66, 66, 66, 1) : const Color.fromRGBO(255, 255, 255, 1);
    titleBackgroundColor ??= Colors.transparent;
    legendTextColor ??= isLight ? const Color.fromRGBO(53, 53, 53, 1) : const Color.fromRGBO(255, 255, 255, 1);
    legendBackgroundColor ??= isLight ? const Color.fromRGBO(255, 255, 255, 1) : const Color.fromRGBO(0, 0, 0, 1);
    legendTitleColor ??= isLight ? const Color.fromRGBO(66, 66, 66, 1) : const Color.fromRGBO(255, 255, 255, 1);
    plotAreaBackgroundColor ??= Colors.transparent;
    plotAreaBorderColor ??= isLight ? const Color.fromRGBO(219, 219, 219, 1) : const Color.fromRGBO(101, 101, 101, 1);
    crosshairLineColor ??= isLight ? const Color.fromRGBO(79, 79, 79, 1) : const Color.fromRGBO(255, 255, 255, 1);
    crosshairBackgroundColor ??= isLight ? const Color.fromRGBO(79, 79, 79, 1) : const Color.fromRGBO(255, 255, 255, 1);
    crosshairLabelColor ??= isLight ? const Color.fromRGBO(255, 255, 255, 1) : const Color.fromRGBO(0, 0, 0, 1);
    tooltipColor ??= isLight ? const Color.fromRGBO(0, 8, 22, 0.75) : const Color.fromRGBO(255, 255, 255, 1);
    tooltipLabelColor ??= isLight ? const Color.fromRGBO(255, 255, 255, 1) : const Color.fromRGBO(0, 0, 0, 1);
    tooltipSeparatorColor ??= isLight ? const Color.fromRGBO(255, 255, 255, 1) : const Color.fromRGBO(150, 150, 150, 1);
    selectionRectColor ??= isLight ? const Color.fromRGBO(41, 171, 226, 0.1) : const Color.fromRGBO(255, 217, 57, 0.3);
    selectionRectBorderColor ??=
        isLight ? const Color.fromRGBO(41, 171, 226, 1) : const Color.fromRGBO(255, 255, 255, 1);
    selectionTooltipConnectorLineColor ??=
        isLight ? const Color.fromRGBO(79, 79, 79, 1) : const Color.fromRGBO(150, 150, 150, 1);
    waterfallConnectorLineColor ??= isLight ? const Color.fromRGBO(0, 0, 0, 1) : const Color.fromRGBO(255, 255, 255, 1);

    return CgChartThemeData.raw(
      brightness: brightness,
      axisLabelColor: axisLabelColor,
      axisLineColor: axisLineColor,
      axisTitleColor: axisTitleColor,
      backgroundColor: backgroundColor,
      titleTextColor: titleTextColor,
      crosshairBackgroundColor: crosshairBackgroundColor,
      crosshairLabelColor: crosshairLabelColor,
      crosshairLineColor: crosshairLineColor,
      legendBackgroundColor: legendBackgroundColor,
      legendTextColor: legendTextColor,
      legendTitleColor: legendTitleColor,
      majorGridLineColor: majorGridLineColor,
      majorTickLineColor: majorTickLineColor,
      minorGridLineColor: minorGridLineColor,
      minorTickLineColor: minorTickLineColor,
      plotAreaBackgroundColor: plotAreaBackgroundColor,
      plotAreaBorderColor: plotAreaBorderColor,
      selectionRectColor: selectionRectColor,
      selectionRectBorderColor: selectionRectBorderColor,
      selectionTooltipConnectorLineColor: selectionTooltipConnectorLineColor,
      titleBackgroundColor: titleBackgroundColor,
      tooltipColor: tooltipColor,
      tooltipSeparatorColor: tooltipSeparatorColor,
      tooltipLabelColor: tooltipLabelColor,
      waterfallConnectorLineColor: waterfallConnectorLineColor,
      titleTextStyle: titleTextStyle,
      axisTitleTextStyle: axisTitleTextStyle,
      axisLabelTextStyle: axisLabelTextStyle,
      axisMultiLevelLabelTextStyle: axisMultiLevelLabelTextStyle,
      plotBandLabelTextStyle: plotBandLabelTextStyle,
      legendTitleTextStyle: legendTitleTextStyle,
      legendTextStyle: legendTextStyle,
      dataLabelTextStyle: dataLabelTextStyle,
      tooltipTextStyle: tooltipTextStyle,
      trackballTextStyle: trackballTextStyle,
      crosshairTextStyle: crosshairTextStyle,
      selectionZoomingTooltipTextStyle: selectionZoomingTooltipTextStyle,
    );
  }

  const CgChartThemeData.raw({
    required this.brightness,
    required this.axisLabelColor,
    required this.axisLineColor,
    required this.axisTitleColor,
    required this.backgroundColor,
    required this.titleTextColor,
    required this.crosshairBackgroundColor,
    required this.crosshairLabelColor,
    required this.crosshairLineColor,
    required this.legendBackgroundColor,
    required this.legendTextColor,
    required this.legendTitleColor,
    required this.majorGridLineColor,
    required this.majorTickLineColor,
    required this.minorGridLineColor,
    required this.minorTickLineColor,
    required this.plotAreaBackgroundColor,
    required this.plotAreaBorderColor,
    required this.selectionRectColor,
    required this.selectionRectBorderColor,
    required this.selectionTooltipConnectorLineColor,
    required this.titleBackgroundColor,
    required this.tooltipColor,
    required this.tooltipSeparatorColor,
    required this.tooltipLabelColor,
    required this.waterfallConnectorLineColor,
    required this.titleTextStyle,
    required this.axisTitleTextStyle,
    required this.axisLabelTextStyle,
    required this.axisMultiLevelLabelTextStyle,
    required this.plotBandLabelTextStyle,
    required this.legendTitleTextStyle,
    required this.legendTextStyle,
    required this.dataLabelTextStyle,
    required this.tooltipTextStyle,
    required this.trackballTextStyle,
    required this.crosshairTextStyle,
    required this.selectionZoomingTooltipTextStyle,
  });

  final Brightness brightness;

  final Color backgroundColor;

  final Color axisLabelColor;

  final Color axisTitleColor;

  final Color axisLineColor;

  final Color majorGridLineColor;

  final Color minorGridLineColor;

  final Color majorTickLineColor;

  final Color minorTickLineColor;

  final Color titleTextColor;

  final Color titleBackgroundColor;

  final Color legendTextColor;

  final Color legendTitleColor;

  final Color legendBackgroundColor;

  final Color plotAreaBackgroundColor;

  final Color plotAreaBorderColor;

  final Color crosshairLineColor;

  final Color crosshairBackgroundColor;

  final Color crosshairLabelColor;

  final Color tooltipColor;

  final Color tooltipLabelColor;

  final Color tooltipSeparatorColor;

  final Color selectionRectColor;

  final Color selectionRectBorderColor;

  final Color selectionTooltipConnectorLineColor;

  final Color waterfallConnectorLineColor;

  final TextStyle? titleTextStyle;

  final TextStyle? axisTitleTextStyle;

  final TextStyle? axisLabelTextStyle;

  final TextStyle? axisMultiLevelLabelTextStyle;

  final TextStyle? plotBandLabelTextStyle;

  final TextStyle? legendTitleTextStyle;

  final TextStyle? legendTextStyle;

  final TextStyle? dataLabelTextStyle;

  final TextStyle? tooltipTextStyle;

  final TextStyle? trackballTextStyle;

  final TextStyle? crosshairTextStyle;

  final TextStyle? selectionZoomingTooltipTextStyle;

  CgChartThemeData copyWith({
    Brightness? brightness,
    Color? axisLabelColor,
    Color? axisLineColor,
    Color? axisTitleColor,
    Color? backgroundColor,
    Color? titleTextColor,
    Color? crosshairBackgroundColor,
    Color? crosshairLabelColor,
    Color? crosshairLineColor,
    Color? legendBackgroundColor,
    Color? legendTextColor,
    Color? legendTitleColor,
    Color? majorGridLineColor,
    Color? majorTickLineColor,
    Color? minorGridLineColor,
    Color? minorTickLineColor,
    Color? plotAreaBackgroundColor,
    Color? plotAreaBorderColor,
    Color? selectionRectColor,
    Color? selectionRectBorderColor,
    Color? selectionTooltipConnectorLineColor,
    Color? titleBackgroundColor,
    Color? tooltipColor,
    Color? tooltipSeparatorColor,
    Color? tooltipLabelColor,
    Color? waterfallConnectorLineColor,
    TextStyle? titleTextStyle,
    TextStyle? axisTitleTextStyle,
    TextStyle? axisLabelTextStyle,
    TextStyle? axisMultiLevelLabelTextStyle,
    TextStyle? plotBandLabelTextStyle,
    TextStyle? legendTitleTextStyle,
    TextStyle? legendTextStyle,
    TextStyle? dataLabelTextStyle,
    TextStyle? tooltipTextStyle,
    TextStyle? trackballTextStyle,
    TextStyle? crosshairTextStyle,
    TextStyle? selectionZoomingTooltipTextStyle,
  }) {
    return CgChartThemeData.raw(
      brightness: brightness ?? this.brightness,
      axisLabelColor: axisLabelColor ?? this.axisLabelColor,
      axisLineColor: axisLineColor ?? this.axisLineColor,
      axisTitleColor: axisTitleColor ?? this.axisTitleColor,
      backgroundColor: backgroundColor ?? this.backgroundColor,
      titleTextColor: titleTextColor ?? this.titleTextColor,
      crosshairBackgroundColor: crosshairBackgroundColor ?? this.crosshairBackgroundColor,
      crosshairLabelColor: crosshairLabelColor ?? this.crosshairLabelColor,
      crosshairLineColor: crosshairLineColor ?? this.crosshairLineColor,
      legendBackgroundColor: legendBackgroundColor ?? this.legendBackgroundColor,
      legendTextColor: legendTextColor ?? this.legendTextColor,
      legendTitleColor: legendTitleColor ?? this.legendTitleColor,
      majorGridLineColor: majorGridLineColor ?? this.majorGridLineColor,
      majorTickLineColor: majorTickLineColor ?? this.majorTickLineColor,
      minorGridLineColor: minorGridLineColor ?? this.minorGridLineColor,
      minorTickLineColor: minorTickLineColor ?? this.minorTickLineColor,
      plotAreaBackgroundColor: plotAreaBackgroundColor ?? this.plotAreaBackgroundColor,
      plotAreaBorderColor: plotAreaBorderColor ?? this.plotAreaBackgroundColor,
      selectionRectColor: selectionRectColor ?? this.selectionRectColor,
      selectionRectBorderColor: selectionRectBorderColor ?? this.selectionRectBorderColor,
      selectionTooltipConnectorLineColor: selectionTooltipConnectorLineColor ?? this.selectionTooltipConnectorLineColor,
      titleBackgroundColor: titleBackgroundColor ?? this.titleBackgroundColor,
      tooltipColor: tooltipColor ?? this.tooltipColor,
      tooltipSeparatorColor: tooltipSeparatorColor ?? this.tooltipSeparatorColor,
      tooltipLabelColor: tooltipLabelColor ?? this.tooltipLabelColor,
      waterfallConnectorLineColor: waterfallConnectorLineColor ?? this.waterfallConnectorLineColor,
      titleTextStyle: titleTextStyle ?? this.titleTextStyle,
      axisTitleTextStyle: axisTitleTextStyle ?? this.axisTitleTextStyle,
      axisLabelTextStyle: axisLabelTextStyle ?? this.axisLabelTextStyle,
      axisMultiLevelLabelTextStyle: axisMultiLevelLabelTextStyle ?? this.axisMultiLevelLabelTextStyle,
      plotBandLabelTextStyle: plotBandLabelTextStyle ?? this.plotBandLabelTextStyle,
      legendTitleTextStyle: legendTitleTextStyle ?? this.legendTitleTextStyle,
      legendTextStyle: legendTextStyle ?? this.legendTextStyle,
      dataLabelTextStyle: dataLabelTextStyle ?? this.dataLabelTextStyle,
      tooltipTextStyle: tooltipTextStyle ?? this.tooltipTextStyle,
      trackballTextStyle: trackballTextStyle ?? this.trackballTextStyle,
      crosshairTextStyle: crosshairTextStyle ?? this.crosshairTextStyle,
      selectionZoomingTooltipTextStyle: selectionZoomingTooltipTextStyle ?? this.selectionZoomingTooltipTextStyle,
    );
  }

  static CgChartThemeData? lerp(CgChartThemeData? a, CgChartThemeData? b, double t) {
    if (a == null && b == null) {
      return null;
    }
    return CgChartThemeData(
      axisLabelColor: Color.lerp(a!.axisLabelColor, b!.axisLabelColor, t),
      axisLineColor: Color.lerp(a.axisLineColor, b.axisLineColor, t),
      axisTitleColor: Color.lerp(a.axisTitleColor, b.axisTitleColor, t),
      backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
      titleTextColor: Color.lerp(a.titleTextColor, b.titleTextColor, t),
      crosshairBackgroundColor: Color.lerp(a.crosshairBackgroundColor, b.crosshairBackgroundColor, t),
      crosshairLabelColor: Color.lerp(a.crosshairLabelColor, b.crosshairLabelColor, t),
      crosshairLineColor: Color.lerp(a.crosshairLineColor, b.crosshairLineColor, t),
      legendBackgroundColor: Color.lerp(a.legendBackgroundColor, b.legendBackgroundColor, t),
      legendTextColor: Color.lerp(a.legendTextColor, b.legendTextColor, t),
      legendTitleColor: Color.lerp(a.legendTitleColor, b.legendTitleColor, t),
      majorGridLineColor: Color.lerp(a.majorGridLineColor, b.majorGridLineColor, t),
      majorTickLineColor: Color.lerp(a.majorTickLineColor, b.majorTickLineColor, t),
      minorGridLineColor: Color.lerp(a.minorGridLineColor, b.minorGridLineColor, t),
      minorTickLineColor: Color.lerp(a.minorTickLineColor, b.minorTickLineColor, t),
      plotAreaBackgroundColor: Color.lerp(a.plotAreaBackgroundColor, b.plotAreaBackgroundColor, t),
      plotAreaBorderColor: Color.lerp(a.plotAreaBorderColor, b.plotAreaBorderColor, t),
      selectionRectColor: Color.lerp(a.selectionRectColor, b.selectionRectColor, t),
      selectionRectBorderColor: Color.lerp(a.selectionRectBorderColor, b.selectionRectBorderColor, t),
      selectionTooltipConnectorLineColor:
          Color.lerp(a.selectionTooltipConnectorLineColor, b.selectionTooltipConnectorLineColor, t),
      titleBackgroundColor: Color.lerp(a.titleBackgroundColor, b.titleBackgroundColor, t),
      tooltipColor: Color.lerp(a.tooltipColor, b.tooltipColor, t),
      tooltipSeparatorColor: Color.lerp(a.tooltipSeparatorColor, b.tooltipSeparatorColor, t),
      tooltipLabelColor: Color.lerp(a.tooltipLabelColor, b.tooltipLabelColor, t),
      waterfallConnectorLineColor: Color.lerp(a.waterfallConnectorLineColor, b.waterfallConnectorLineColor, t),
      titleTextStyle: TextStyle.lerp(a.titleTextStyle, b.titleTextStyle, t),
      axisTitleTextStyle: TextStyle.lerp(a.axisTitleTextStyle, b.axisTitleTextStyle, t),
      axisLabelTextStyle: TextStyle.lerp(a.axisLabelTextStyle, b.axisLabelTextStyle, t),
      axisMultiLevelLabelTextStyle: TextStyle.lerp(a.axisMultiLevelLabelTextStyle, b.axisMultiLevelLabelTextStyle, t),
      plotBandLabelTextStyle: TextStyle.lerp(a.plotBandLabelTextStyle, b.plotBandLabelTextStyle, t),
      legendTitleTextStyle: TextStyle.lerp(a.legendTitleTextStyle, b.legendTitleTextStyle, t),
      legendTextStyle: TextStyle.lerp(a.legendTextStyle, b.legendTextStyle, t),
      dataLabelTextStyle: TextStyle.lerp(a.dataLabelTextStyle, b.dataLabelTextStyle, t),
      tooltipTextStyle: TextStyle.lerp(a.tooltipTextStyle, b.tooltipTextStyle, t),
      trackballTextStyle: TextStyle.lerp(a.trackballTextStyle, b.trackballTextStyle, t),
      crosshairTextStyle: TextStyle.lerp(a.crosshairTextStyle, b.crosshairTextStyle, t),
      selectionZoomingTooltipTextStyle:
          TextStyle.lerp(a.selectionZoomingTooltipTextStyle, b.selectionZoomingTooltipTextStyle, t),
    );
  }

  @override
  bool operator ==(Object other) {
    if (identical(this, other)) {
      return true;
    }
    if (other.runtimeType != runtimeType) {
      return false;
    }

    return other is CgChartThemeData &&
        other.axisLabelColor == axisLabelColor &&
        other.axisLineColor == axisLineColor &&
        other.axisTitleColor == axisTitleColor &&
        other.backgroundColor == backgroundColor &&
        other.titleTextColor == titleTextColor &&
        other.crosshairBackgroundColor == crosshairBackgroundColor &&
        other.crosshairLabelColor == crosshairLabelColor &&
        other.crosshairLineColor == crosshairLineColor &&
        other.legendBackgroundColor == legendBackgroundColor &&
        other.legendTextColor == legendTextColor &&
        other.legendTitleColor == legendTitleColor &&
        other.majorGridLineColor == majorGridLineColor &&
        other.majorTickLineColor == majorTickLineColor &&
        other.minorGridLineColor == minorGridLineColor &&
        other.minorTickLineColor == minorTickLineColor &&
        other.plotAreaBackgroundColor == plotAreaBackgroundColor &&
        other.plotAreaBorderColor == plotAreaBorderColor &&
        other.selectionRectColor == selectionRectColor &&
        other.selectionRectBorderColor == selectionRectBorderColor &&
        other.selectionTooltipConnectorLineColor == selectionTooltipConnectorLineColor &&
        other.titleBackgroundColor == titleBackgroundColor &&
        other.tooltipColor == tooltipColor &&
        other.tooltipSeparatorColor == tooltipSeparatorColor &&
        other.tooltipLabelColor == tooltipLabelColor &&
        other.waterfallConnectorLineColor == waterfallConnectorLineColor &&
        other.titleTextStyle == titleTextStyle &&
        other.axisTitleTextStyle == axisTitleTextStyle &&
        other.axisLabelTextStyle == axisLabelTextStyle &&
        other.axisMultiLevelLabelTextStyle == axisMultiLevelLabelTextStyle &&
        other.plotBandLabelTextStyle == plotBandLabelTextStyle &&
        other.legendTitleTextStyle == legendTitleTextStyle &&
        other.legendTextStyle == legendTextStyle &&
        other.dataLabelTextStyle == dataLabelTextStyle &&
        other.tooltipTextStyle == tooltipTextStyle &&
        other.trackballTextStyle == trackballTextStyle &&
        other.crosshairTextStyle == crosshairTextStyle &&
        other.selectionZoomingTooltipTextStyle == selectionZoomingTooltipTextStyle;
  }

  @override
  int get hashCode {
    final List<Object?> values = <Object?>[
      axisLabelColor,
      axisLineColor,
      axisTitleColor,
      backgroundColor,
      titleTextColor,
      crosshairBackgroundColor,
      crosshairLabelColor,
      crosshairLineColor,
      legendBackgroundColor,
      legendTextColor,
      legendTitleColor,
      majorGridLineColor,
      majorTickLineColor,
      minorGridLineColor,
      minorTickLineColor,
      plotAreaBackgroundColor,
      plotAreaBorderColor,
      selectionRectColor,
      selectionRectBorderColor,
      selectionTooltipConnectorLineColor,
      titleBackgroundColor,
      tooltipColor,
      tooltipSeparatorColor,
      tooltipLabelColor,
      waterfallConnectorLineColor,
      titleTextStyle,
      axisTitleTextStyle,
      axisLabelTextStyle,
      axisMultiLevelLabelTextStyle,
      plotBandLabelTextStyle,
      legendTitleTextStyle,
      legendTextStyle,
      dataLabelTextStyle,
      tooltipTextStyle,
      trackballTextStyle,
      crosshairTextStyle,
      selectionZoomingTooltipTextStyle,
    ];
    return Object.hashAll(values);
  }

  @override
  void debugFillProperties(DiagnosticPropertiesBuilder properties) {
    super.debugFillProperties(properties);
    final CgChartThemeData defaultData = CgChartThemeData();
    properties.add(EnumProperty<Brightness>('brightness', brightness, defaultValue: defaultData.brightness));
    properties.add(ColorProperty('axisLabelColor', axisLabelColor, defaultValue: defaultData.axisLabelColor));
    properties.add(ColorProperty('axisLineColor', axisLineColor, defaultValue: defaultData.axisLineColor));
    properties.add(ColorProperty('axisTitleColor', axisTitleColor, defaultValue: defaultData.axisTitleColor));
    properties.add(ColorProperty('backgroundColor', backgroundColor, defaultValue: defaultData.backgroundColor));
    properties.add(ColorProperty('titleTextColor', titleTextColor, defaultValue: defaultData.titleTextColor));
    properties.add(ColorProperty('crosshairBackgroundColor', crosshairBackgroundColor,
        defaultValue: defaultData.crosshairBackgroundColor,),);
    properties
        .add(ColorProperty('crosshairLabelColor', crosshairLabelColor, defaultValue: defaultData.crosshairLabelColor));
    properties
        .add(ColorProperty('crosshairLineColor', crosshairLineColor, defaultValue: defaultData.crosshairLineColor));
    properties.add(
        ColorProperty('legendBackgroundColor', legendBackgroundColor, defaultValue: defaultData.legendBackgroundColor),);
    properties.add(ColorProperty('legendTextColor', legendTextColor, defaultValue: defaultData.legendTextColor));
    properties.add(ColorProperty('legendTitleColor', legendTitleColor, defaultValue: defaultData.legendTitleColor));
    properties
        .add(ColorProperty('majorGridLineColor', majorGridLineColor, defaultValue: defaultData.majorGridLineColor));
    properties
        .add(ColorProperty('majorTickLineColor', majorTickLineColor, defaultValue: defaultData.majorTickLineColor));
    properties
        .add(ColorProperty('minorGridLineColor', minorGridLineColor, defaultValue: defaultData.minorGridLineColor));
    properties
        .add(ColorProperty('minorTickLineColor', minorTickLineColor, defaultValue: defaultData.minorTickLineColor));
    properties.add(ColorProperty('plotAreaBackgroundColor', plotAreaBackgroundColor,
        defaultValue: defaultData.plotAreaBackgroundColor,),);
    properties
        .add(ColorProperty('plotAreaBorderColor', plotAreaBorderColor, defaultValue: defaultData.plotAreaBorderColor));
    properties
        .add(ColorProperty('selectionRectColor', selectionRectColor, defaultValue: defaultData.selectionRectColor));
    properties.add(ColorProperty('selectionRectBorderColor', selectionRectBorderColor,
        defaultValue: defaultData.selectionRectBorderColor,),);
    properties.add(ColorProperty('selectionTooltipConnectorLineColor', selectionTooltipConnectorLineColor,
        defaultValue: defaultData.selectionTooltipConnectorLineColor,),);
    properties.add(
        ColorProperty('titleBackgroundColor', titleBackgroundColor, defaultValue: defaultData.titleBackgroundColor),);
    properties.add(ColorProperty('tooltipColor', tooltipColor, defaultValue: defaultData.tooltipColor));
    properties.add(
        ColorProperty('tooltipSeparatorColor', tooltipSeparatorColor, defaultValue: defaultData.tooltipSeparatorColor),);
    properties.add(ColorProperty('tooltipLabelColor', tooltipLabelColor, defaultValue: defaultData.tooltipLabelColor));
    properties.add(ColorProperty('waterfallConnectorLineColor', waterfallConnectorLineColor,
        defaultValue: defaultData.waterfallConnectorLineColor,),);
    properties.add(
        DiagnosticsProperty<TextStyle>('titleTextStyle', titleTextStyle, defaultValue: defaultData.titleTextStyle),);
    properties.add(DiagnosticsProperty<TextStyle>('axisTitleTextStyle', axisTitleTextStyle,
        defaultValue: defaultData.axisTitleTextStyle,),);
    properties.add(DiagnosticsProperty<TextStyle>('axisLabelTextStyle', axisLabelTextStyle,
        defaultValue: defaultData.axisLabelTextStyle,),);
    properties.add(DiagnosticsProperty<TextStyle>('axisMultiLevelLabelTextStyle', axisMultiLevelLabelTextStyle,
        defaultValue: defaultData.axisMultiLevelLabelTextStyle,),);
    properties.add(DiagnosticsProperty<TextStyle>('plotBandLabelTextStyle', plotBandLabelTextStyle,
        defaultValue: defaultData.plotBandLabelTextStyle,),);
    properties.add(DiagnosticsProperty<TextStyle>('legendTitleTextStyle', legendTitleTextStyle,
        defaultValue: defaultData.legendTitleTextStyle,),);
    properties.add(
        DiagnosticsProperty<TextStyle>('legendTextStyle', legendTextStyle, defaultValue: defaultData.legendTextStyle),);
    properties.add(DiagnosticsProperty<TextStyle>('dataLabelTextStyle', dataLabelTextStyle,
        defaultValue: defaultData.dataLabelTextStyle,),);
    properties.add(DiagnosticsProperty<TextStyle>('tooltipTextStyle', tooltipTextStyle,
        defaultValue: defaultData.tooltipTextStyle,),);
    properties.add(DiagnosticsProperty<TextStyle>('trackballTextStyle', trackballTextStyle,
        defaultValue: defaultData.trackballTextStyle,),);
    properties.add(DiagnosticsProperty<TextStyle>('crosshairTextStyle', crosshairTextStyle,
        defaultValue: defaultData.crosshairTextStyle,),);
    properties.add(DiagnosticsProperty<TextStyle>('selectionZoomingTooltipTextStyle', selectionZoomingTooltipTextStyle,
        defaultValue: defaultData.selectionZoomingTooltipTextStyle,),);
  }
}
